package com.chapter.sample.redis.answer;

import java.util.HashSet;
import java.util.Set;

public class HashConflict {
    public static void main(String[] args) {
        System.out.println("Aa".hashCode());
        System.out.println("BB".hashCode());

        Set<Integer> set = new HashSet<>();
        int hashCode;
        for (int i = 1; i <= 200000; i++) {
            hashCode = new Object().hashCode();
            if (set.contains(hashCode)) {
                System.out.println("运行到:" + i + "次，出现了hash冲突,hoshCode： " + hashCode);
                continue;
            }
            set.add(hashCode);
        }
    }
}
